<template>
	<!-- 帖子收藏 -->
	<div class="MainBody">
		<MyPostsCollect :PostsData="PostsData">
		</MyPostsCollect>
		<div class="footer_page">
			<el-pagination @current-change="handleCurrentChange" :current-page="currentPage" :page-size="pageSize"
				layout="total, prev, pager, next, jumper" :total="total"></el-pagination>
		</div>
	</div>
</template>

<script>
	import MyPostsCollect from "@/components/foreground/MyPocket/MyPostsCollect.vue"
	import postsApi from "@/api/posts.js"
	export default {
		components: {
			MyPostsCollect
		},
		data() {
			return {
				PostsData: [],
				total: 0,
				pageSize: 10,
				currentPage: 1,
			}
		},
		methods: {
			async getMyCollects() {
				const res = await postsApi.getMyCollects("/ZnCollectPost/getMyCollects", {
					currentPage: this.currentPage,
					pageSize: this.pageSize
				});
				if (res.code == 200) {
					this.PostsData = res.data.records;
					this.total = res.data.total;
				}
			},
			handleCurrentChange(page) {
				this.currentPage = page;
				this.getMyCollects();
			},
		},
		created() {
			this.getMyCollects();
		}
	}
</script>

<style lang="scss" scoped>
	.MainBody {}
</style>